#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#include "errsys.h"

int main(int argc, char **argv)
{
	pid_t pid = fork();
	if(pid<0)
		err_sys("fork");
	if(pid == 0){
		sleep(10);
		printf("I am Child:%d.\n",getpid());
	}else{
		sleep (2);
		printf("I am parent:%d.\n",getpid());
		int status;
		if( (pid=waitpid(pid, &status,0))<0 )
			err_sys("waitpid");
	}
	return 0;
}

